﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SSISPackageExplorer.UI
{
    public abstract class NodeBase : TreeNode
    {
        public Guid Guid { get; set; }

        public string SearchText { get; set; }

        public void AddChild(NodeBase child)
        {
            this.Nodes.Add(child);

            NodeBase parent = this;
            while (parent != null)
            {
                parent.SearchText += child.SearchText;
                parent = (NodeBase)parent.Parent;
            }
        }

        public new string Text
        {
            get
            {
                return base.Text;
            }

            set
            {
                base.Text = value;
                this.SearchText += value;
            }
        }
    }
}
